/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.GregorianCalendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Ana
 */
@Entity
public class Avaliacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @TableGenerator(name="Ava_gen",
            table = "ID_GEN",
            pkColumnName = "GEN_NAME",
            valueColumnName = "GEN_VAL",
            pkColumnValue = "id",
            initialValue = 1,
            allocationSize = 100)
    @GeneratedValue(generator = "Ava_gen",strategy = GenerationType.TABLE)
    private Long id;
    @Temporal(TemporalType.TIMESTAMP)
    private GregorianCalendar dttermino;
    @OneToOne(mappedBy = "avaliacao")
    private Viagem viagem;
    private int pontuacao;

    public int getPontuacao() {
        return pontuacao;
    }

    public void setPontuacao(int pontuacao) {
        this.pontuacao = pontuacao;
    }
    
    public GregorianCalendar getDttermino() {
        return dttermino;
    }

    public void setDttermino(GregorianCalendar dttermino) {
        this.dttermino = dttermino;
    } 
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Avaliacao)) {
            return false;
        }
        Avaliacao other = (Avaliacao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Avaliacao[ id=" + id + " ]";
    }
    
}
